package com.junmoo.www.auth.module.system.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/role")
@Slf4j
public class SysRoleController {
//    @Autowired
//    SysRoleService sysRoleService;
//    @ApiOperation("查询suoy")
//    @GetMapping("/findAll")
//    public Result findAll(){
//        return Result.success("success",sysRoleService.findAll());
//    }
//    @ApiOperation("分页")
//    @GetMapping("/page")
//    public Result page(SysRole search, Integer currentPage, Integer pageSize,
//                       @RequestParam(defaultValue = "roleCode") String sortField, @RequestParam(defaultValue = "asc")String sortOrder){
//        Sort.Direction direction= sortOrder.toLowerCase().contains("asc")?Sort.Direction.ASC:Sort.Direction.DESC;
//        Pageable pageable = PageRequest.of(currentPage - 1, pageSize,Sort.by(direction,sortField));
//        Page<SysRole> page =  sysRoleService.page( search, pageable);
//        return Result.success(page);
//    }
//    @ApiOperation("新增")
//    @PostMapping()
//    public Result create(@RequestBody SysRole entity){
//        return  sysRoleService.create( entity);
//    }
//    @ApiOperation("编辑")
//    @PutMapping()
//    public Result edit(@RequestBody SysRole entity){
//        return  sysRoleService.edit( entity);
//    }
//    @ApiOperation("删除")
//    @DeleteMapping()
//    public Result deleteByIds(@RequestBody List<Number> ids){
//        return  sysRoleService.deleteByIds( ids);
//    }
//    @ApiOperation("分配资源")
//    @PostMapping("/assignResource/{roleId}")
//    public Result assignRole(@PathVariable("roleId") Number roleId , @RequestBody List<Number> resourceIds){
//        return  sysRoleService.assignResource( roleId,resourceIds);
//    }
}
